﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EmployeeLeave.aspx.cs"
    Inherits="WebUI.Pages.EmployeeLeaveManagement" MasterPageFile="~/MasterPage/Default.Master" %>

<%@ Register Src="../UserControls/EmployeeNavigate.ascx" TagName="EmployeeNavigate"
    TagPrefix="HRM" %>
<asp:Content runat="server" ContentPlaceHolderID="cphMain">
    <h3>
        Nghỉ phép:
        <HRM:EmployeeNavigate runat="server" ID="ucEmpNavigate" />
    </h3>
    
    <div style="margin: 5 0 0 15">
        <div style="margin: 0 0 5 0">
            <asp:LinkButton runat="server" Text="Thêm" ID="lnkAdd" Font-Size="10pt" OnClick="lnkAdd_Click"></asp:LinkButton>
        </div>
        
        <div>
            <asp:GridView runat="server" ID="grvEmployeeLeave" AutoGenerateColumns="false" Width="90%"
                OnRowCreated="grvEmployeeLeave_RowCreated" OnRowDataBound="grvEmployeeLeave_RowDataBound"
                OnRowCommand="grvEmployeeLeave_RowCommand" OnPageIndexChanging="grvEmployeeLeave_PageIndexChanging">
                <Columns>
                    <asp:TemplateField>
                        <ItemStyle Width="16" />
                        <ItemTemplate>
                            <input type="checkbox" name="chkSelect" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField HeaderText="ID" Visible="false" DataField="ID" />
                    <asp:BoundField HeaderText="Từ ngày" DataField="From" DataFormatString="{0:dd/MM/yyyy}" />
                    <asp:BoundField HeaderText="Đến ngày" DataField="To" DataFormatString="{0:dd/MM/yyyy}" />
                    <asp:BoundField HeaderText="Số ngày" DataField="NumOfDays" />
                    <asp:BoundField HeaderText="Loại" DataField="Name" />
                    <asp:TemplateField>
                        <ItemStyle HorizontalAlign="Center" Width="50" />
                        <ItemTemplate>
                            <div runat="server" id="divAction" style="font-size: 8pt;">
                                <asp:LinkButton runat="server" ID="lnkEdit" Text="Sửa" CommandArgument='<%#Eval("ID") %>'
                                    CommandName="EditItem"></asp:LinkButton>
                                <asp:LinkButton runat="server" ID="lnkDelete" Text="Xóa" CommandArgument='<%#Eval("ID") %>'
                                    CommandName="DeleteItem"></asp:LinkButton>
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <EmptyDataTemplate>
                    <div class="message">
                        Không có dữ liệu.
                    </div>
                </EmptyDataTemplate>
            </asp:GridView>
        </div>
        
        <div runat="server" style="display: none; margin: 20 0 0 0;" id="divAction">
            <table cellpadding="2" cellspacing="2">
                <tr>
                    <td>Loại</td>
                    <td>
                        <asp:DropDownList runat="server" ID="ddlLeaveType" Width="150"></asp:DropDownList>
                    </td>
                    <td style="width:32px;">&nbsp;</td>
                    <td>Số ngày</td>
                    <td>
                        <asp:TextBox runat="server" ID="txtNumOfDay" Width="150"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>Từ ngày</td>
                    <td>
                        <asp:TextBox runat="server" ID="txtFrom" Width="150"></asp:TextBox>
                    </td>
                    <td></td>
                    <td>Đến ngày</td>
                    <td>
                        <asp:TextBox runat="server" ID="txtTo" Width="150"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td colspan="5" align="right">
                        <asp:Button runat="server" ID="btnAction" Text="Thêm" Width="50" OnClick="btnAction_Click" />
                    </td>
                </tr>
            </table>
        </div>
    </div>

    <script language="javascript" type="text/javascript">       
        function selectAll(id)
        {
            var value=document.getElementById(id).checked;
            var chkGroup = document.getElementsByName('chkSelect');
            for(i=0;i<chkGroup.length;i++)
            {
                chkGroup[i].checked=value;
            }
        } 
        
        $(function() 
        {
          $("#<%= txtFrom.ClientID %>" ).datepicker();
          $("#<%= txtTo.ClientID %>" ).datepicker();  
        });      
    </script>

</asp:Content>
